From cfe8223cc0f57eacfd293b39739f0a38e94a2044 Mon Sep 17 00:00:00 2001 From: Jake Kerr Date: Sun, 5 Apr 2015 21:39:51 +0900 Subject: [PATCH] Don't short circuit dep matching as soon as a name matches --- src/cargo/ops/cargo_rustc/context.rs | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 80f023bdf..c7cfbfe77 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -339,22 +339,22 @@ impl<'a, 'b: 'a> Context<'a, 'b> { }; let mut ret = deps.map(|id| self.get_package(id)).filter(|dep| { let pkg_dep = pkg.dependencies().iter().find(|d| { - d.name() == dep.name() - }).unwrap(); - - // If this target is a build command, then we only want build - // dependencies, otherwise we want everything *other than* build - // dependencies. - let is_correct_dep = target.is_custom_build() == pkg_dep.is_build(); - - // If this dependency is *not* a transitive dependency, then it - // only applies to test/example targets - let is_actual_dep = pkg_dep.is_transitive() || - target.is_test() || - target.is_example() || - profile.test; - - is_correct_dep && is_actual_dep + d.name() == dep.name() && + + // If this target is a build command, then we only want build + // dependencies, otherwise we want everything *other than* build + // dependencies. + target.is_custom_build() == d.is_build() && + + // If this dependency is *not* a transitive dependency, then it + // only applies to test/example targets + (d.is_transitive() || + target.is_test() || + target.is_example() || + profile.test) + }); + + pkg_dep.is_some() }).filter_map(|pkg| { pkg.targets().iter().find(|t| t.is_lib()).map(|t| { (pkg, t, self.lib_profile(pkg.package_id())) -- 2.30.2